home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / WHERE.BAT < prev    next >
DOS Batch File  |  1990-10-21  |  1KB  |  48 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────┐
  4. echo │ Searchstring find and count of file names on a device │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sun 21-Oct-90 │
  6. echo └───────────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. if "%1"=="" goto _help
  10.  
  11. rem Change the filename searchstring to upper case
  12. rem Credit should go where credit is due
  13. rem The idea of using path for the upper case conversion is from the
  14. rem PC Magazine. This code, however, is entirely my own (un)doing :-)
  15. set _stash=%path%
  16. path %1
  17. set _search=%path%
  18. path %_stash%
  19. set _stash=
  20.  
  21. chkdsk /v | find "%_search%"
  22. echo Number of entries found:
  23. chkdsk /v | find /c "%_search%"
  24. set _search=
  25. goto _out
  26.  
  27. :_help
  28. echo Usage: WHERE SearchString
  29. echo.
  30. echo E.g.  WHERE where.bat  finds all occurrences of where.bat on the device
  31. echo and   WHERE .com       finds all .com files
  32. echo but   WHERE com        finds all filenames which include the string "COM"
  33. echo.
  34. echo Contrary to the ordinary MsDos DIR convention this system
  35. echo matches the search string anywhere in the body of the filename
  36. echo.
  37. echo Do not use the wildcards * or ?
  38. echo They are not needed.
  39. echo.
  40. echo If you get an "Out of environment space" message, increase your
  41. echo environment space by using shell configuration in config.sys:
  42. echo Example: shell=c:\bin\command.com /e:1024 /p
  43. echo.
  44. echo.
  45.  
  46. :_out
  47. echo on
  48.